﻿
using zijian666.Converts.Abstractions;
using zijian666.Converts.Convertor;
using zijian666.Converts.Core;

namespace zijian666.Converts.Factory;

/// <summary>
/// 枚举转换器 <seealso cref="EnumConvertor{T}"/> 工厂
/// </summary>
public sealed class EnumConvertorFactory : IConvertorFactory
{
    /// <inheritdoc/>
    public MatchedConvertor<T> Create<T>()
    {
        if (typeof(T).IsEnum)
        {
            return new MatchedConvertor<T>(new EnumConvertor<T>(), MacthedType.Equals);
        }
        return default;
    }
}
